package tau.adx.common.advertisers;

import lombok.AllArgsConstructor;
import lombok.Data;
import tau.adx.common.AdxConstants;
import tau.adx.common.contracts.MonthlyContract;

/**
 * An advertiser.
 * 
 * @author greenwald
 * 
 */
@Data
@AllArgsConstructor
public class SimpleAdvertiser implements Advertiser {

	/**
	 * Advertiser's name.
	 */
	private String name;

	/**
	 * @see Advertiser#generateMonthlyContract()
	 */
	@Override
	public MonthlyContract generateMonthlyContract() {
		int monthlyBudget = (int) (Math.random() * AdxConstants.MAX_MONTHLY_BUDGET);
		int dailyLimit = (int) (monthlyBudget / AdxConstants.MONTH_LENGTH);
		MonthlyContract monthlyContract = new MonthlyContract(null, this,
				dailyLimit, monthlyBudget);
		return monthlyContract;
	}
}
